"use strict";
import * as React from 'react';
import { autoSize, commonStyles } from "../../assets/styles/common";
import MyText from "../../component/MyText";
import Line from "../../component/Line";
import WithDrawListItem from "../../component/WithDrawItem";
const { View, FlatList } = require('react-native');
const { connect } = require('react-redux');
class WithdrawPage extends React.Component {
    constructor() {
        super(...arguments);
        this.onRefresh = () => {
            this.props.dispatch({
                type: 'balance/fetchWithDrawList'
            });
        };
        this.renderHeader = () => {
            return (<View style={[commonStyles.flexRow, { height: autoSize(46), paddingHorizontal: 10 }]}>
                <View style={[{ display: 'flex', flex: 0.8, justifyContent: 'center' }]}>
                    <MyText>提取时间</MyText>
                </View>
                <View style={[commonStyles.centerVH, { display: 'flex', flex: 0.2, justifyContent: 'center' }]}>
                    <MyText>金额</MyText>
                </View>

            </View>);
        };
    }
    render() {
        return (<FlatList data={this.props.balance.withDrawList} onRefresh={this.onRefresh} refreshing={this.props.balance.loading} ListHeaderComponent={this.renderHeader} keyExtractor={(item) => item.updated_at} ItemSeparatorComponent={() => <Line />} renderItem={(params) => <WithDrawListItem {...params.item} key={params.index}/>}/>);
    }
}
export default connect(({ auth, balance }) => ({ auth, balance }))(WithdrawPage);
